Fix DoubleRenderError on unsubscribe link for members with incomplete details - #2836
Merged
Conversation
… details MembersController#unsubscribe called authenticate_member! and then unconditionally redirected to subscriptions_path. For members whose profile is incomplete, finish_registration (inside authenticate_member!) already redirects to edit_member_details_path, so the second redirect raised AbstractController::DoubleRenderError (Rollbar item 660). Guard the second redirect with `unless performed?` and add a regression spec for the incomplete-details path.
mroderick
force-pushed
the
fix/unsubscribe-double-render
branch
from
September 2, 2026 10:08
2a47704 to
a39aad9
Compare
mroderick
marked this pull request as ready for review
September 2, 2026 10:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Rollbar items 660 and 559 report
AbstractController::DoubleRenderErroronGET /unsubscribe/:token.MembersController#unsubscribesets the member's session, then callsauthenticate_member!and afterwards unconditionally redirects tosubscriptions_path. For members whose profile is incomplete,finish_registration(insideauthenticate_member!) already redirects toedit_member_details_path, so the second redirect raisedDoubleRenderError. The cascade then bounced twice more: the inlinerescue StandardErrorcaught it and calledredirect_to root_pathon the already-performed response (#559), and the productionrescue_from Exceptionhandler failed to render the already-committed response (#660). One click, three chained render errors.This only affects members who click an unsubscribe email link before completing registration details. Every other
authenticate_member!caller runs it as abefore_action, where Rails halts the chain on redirect — this was the only explicit call site.Change
unsubscribewithunless performed?(app/controllers/members_controller.rb:40). Members with incomplete details now land on the details page (the intended redirect); everyone else still reaches their subscriptions page. With the first conflict gone, neither the rescue arm nor the error handler can fire on a performed response, so both Rollbar items are fixed.spec/controllers/members_controller_spec.rb). The spec fails with the exact production error when the guard is reverted.Verification
bundle exec rspec spec/controllers/members_controller_spec.rb— 3 examples, 0 failuresbundle exec rubocopon both changed files — no offensesDoubleRenderErrorin the new spec